package BizLogic;

import java.sql.SQLException;
import java.util.ArrayList;

import model.Facility;

import dao.DAOFactory;
import dao.FacilityDAO;

public class FacilityManager {
	private FacilityDAO facilityDAO;

	public FacilityManager() {
		facilityDAO = DAOFactory.loadInstance().getFacilityDAO();
	}

	Facility facility = new Facility();

	public ArrayList<String> getFacilityNames() {
		ArrayList<String> facility = facilityDAO.findFacilityNames();
		return facility;
	}

	public ArrayList<Facility> getEverything() {
		ArrayList<Facility> facility = null;
		try {
			facility = facilityDAO.findEverything();
		} catch (SQLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		return facility;
	}

	public void FacilityUpdate(String name, String desc, int seat) {
		facility.setFacilityName(name);
		facility.setDescription(desc);
		facility.setSeatingCapacity(seat);
		try {
			facilityDAO.updateFacility(facility);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public Facility findbyName(String f) {
		Facility facility = new Facility();
		try {
			facility = facilityDAO.findByFacilityName(f);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return facility;
	}

}
